function res = TP1NR(outfilename)
	outfile = fopen(outfilename, 'w');
	digitos = [2, 4, 6, 8];
	iteraciones = 4;
	fprintf(outfile, '\\begin{tabular}{|c|%s', repmat('l|l|', 1, iteraciones));
	fprintf(outfile, '}\\hline\nD\\''igitos ');
	for t = 1:iteraciones
		fprintf(outfile, '& $x_{%d}$ & $\\vert e_{%d} \\vert$ ', t,t);
	end;
	fprintf(outfile, ' \\\\\\hline\n');
	res = [];
	for t = digitos
		gr = grillaCorta(t);
		fprintf(outfile, '$%d$', t);
		rest.x = puntoFijo(1, @(x) gr(gr(gr(x) / 2) + gr(1 / gr(x))), iteraciones);
		rest.d = abs(sqrt(2) - rest.x);
		rest.e = abs(rest.d ./ rest.x);
		for i = 1:iteraciones
			fprintf(outfile, sprintf('\t& $%%.%df$\t& $%%f$',
					max(0, t-ceil(log10(rest.x(i))))),
				rest.x(i), rest.e(i));
		end;
		fprintf(outfile, ' \\\\\\hline\n');
		res = [res;rest];
	end;
	fprintf(outfile, '\\end{tabular}\n');
	fclose(outfile);
	figure();
	semilogy(1:iteraciones, res(1).d, '-x;d=2;',
		1:iteraciones, res(2).d, '-x;d=4;',
		1:iteraciones, res(3).d, '-x;d=6;',
		1:iteraciones, res(4).d, '-x;d=8;');
	xlabel('Iteraciones');
	ylabel('|d|');
	print('tex/erroresNR.png');
end;

